﻿<?php
// 本类由系统自动生成，仅供测试用途
class SignupAction extends BaseAction {
	public function index() {

		header("Content-Type:text/html; charset=utf-8");
		
		
		if (empty ( $_POST ['vcode'] )) {
			$this->error ( '验证码必须！' );
		}
		
		if ($_SESSION ['verify'] != md5 ( $_POST ['vcode'] )) {
			$this->error ( '验证码错误！' );
		}
		
		
		$model = D ('Enroll');

		if (false === $model->create ()) {
			$this->error ( $model->getError () );
		}

		//保存当前数据对象
		$list=$model->add ();
		if ($list!==false) { //保存成功
			$this->assign ( 'jumpUrl', Cookie::get ( '_currentUrl_' ) );
   			echo '<script language="javascript">alert("报名成功！");location.href="/";</script>';	//返回
   			exit;
		} else {
			//失败提示
			echo '<script language="javascript">alert("提交报名失败!");history.back();</script>';	//返回
			exit;
		}

	}
}
?>